package de.piratech.dasding.test;

import java.util.Date;
import java.util.List;

import de.piratech.dasding.data.Event;
import de.piratech.dasding.data.Location;
import de.piratech.dasding.data.database.DatabaseException;
import de.piratech.dasding.data.database.EventData;

public class EventDataTestImpl implements EventData {

  public static Event getEvent_return = new Event();
  public static boolean throwException = false;

  public static void reset() {
    getEvent_return = new Event();
    getEvent_return.setName("initialName");
    getEvent_return.setDescription("initialDescription");
    getEvent_return.setCategory("initialCategoryId");
    getEvent_return.setContact("initialContactId");
    getEvent_return.setLocation(new Location());
    getEvent_return.setResponsible("initialResponsibleId");
    getEvent_return.setTime(new Date());

    throwException = false;
  }

  @Override
  public Event createEvent(Event pEvent) throws DatabaseException {
    pEvent.setId("event id");
    return pEvent;
  }

  @Override
  public void deleteEvent(Event pEvent) throws DatabaseException {
    // TODO Auto-generated method stub

  }

  @Override
  public void updateEvent(Event pEvent) throws DatabaseException {
    // TODO Auto-generated method stub

  }

  @Override
  public Event getEvent(String pId) throws DatabaseException {
    if (throwException) {
      throw new DatabaseException();
    }
    if (getEvent_return != null) {
      getEvent_return.setId(pId);
    }
    return getEvent_return;
  }

  @Override
  public List<Event> getEvents() throws DatabaseException {
    // TODO Auto-generated method stub
    return null;
  }

  @Override
  public List<Event> findByCategories(List<String> pCategory)
      throws DatabaseException {
    // TODO Auto-generated method stub
    return null;
  }

}
